<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<html>
  <head>
    <title>${appname}</title>
	<%@include file="../meta.jsp"%>
	<script src="${ctx}/js/common/jquery-1.6.2.min.js" type="text/javascript"></script>
	<script language="javascript" type="text/javascript" src="${ctx}/js/lhgdialog/lhgdialog.js"></script>
	<script src="${ctx}/js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
  </head>
  
  <body>
    <div class="Teg_body">
    	<%@include file="../header.jsp"%>
    	
    	<div class="Teg_content">
    		<div class="content_left i-pane" id="zhd_LeftPane" paneid="LeftPane">
    			<div class="m-second-menu-title">
	    			<span class="Head">会议室</span>
    			</div>
    			<div class="m-second-menu-ct ZHDAlignleft">
	    			<div class="accordion-3-container">
	    				<ul class="accordion-3">
	    					<li  ${opt == 'my'?'class="active"':''}><div class="level-first"><a href="${ctx}/meeting_myMeeting.do?opt=my">我的会议</a></div></li>
	    					<li ${opt == 'all'?'class="active"':''}><div class="level-first"><a href="${ctx}/meeting_search.do?opt=all">会议总览</a></div></li>
	    					
	    					<s:action namespace="/pubApps" name="meetingAuth/getAuth" ></s:action>
	    					<s:if test="%{#request.meetingAuth>0}">
	    					<li><div class="level-first"><a href="${ctx}/meeting_schedule.do">会议室预定</a></div></li>
	    					</s:if>
	    					
	    					<c:forEach items="${lbList}" var="listrow">
	    					<li ${listrow.id == mrid?'class="active"':''}><div class="level-first"><a title="${listrow.bz}" href="${ctx}/meeting_search.do?mrid=${listrow.id}">${listrow.name}</a></div></li>
	    					</c:forEach>
	    				</ul>
	    			</div>
    			</div>
    			
    			<%@include file="../leftmenu.jsp"%>
    		</div>
    		<div class="content_right">
    			<div class="second_breadcrumb">
    				<span class="current_position">您的当前位置：<a href="${ctx}">首页</a>></span><span><a href="${ctx}/meeting_search.do" class="SkinObject">会议室预定</a></span>
    			</div>
    			<div class="content_ct i-pane" id="zhd_ContentPane" style="margin-top: 5px;">
    				<s:form action="meeting_search.do" method="post">
    				<div class="search_cond">
    					&nbsp;&nbsp;
    					会议标题：<s:textfield key="zt" title="请输入名称主题" cssClass="form-txtinput" id="zt" maxlength="20" value="%{model.zt}"/>
    					会议室：<mytag:select id="mrid" title="请输入类别" name="mrid" sql="basedata" isSql="false" condition="16" dataType="Long" listKey="id" listValue="name" headerKey="" headerValue="请选择"/>
    					时间：<s:textfield key="hyrqBegin" title="请选择时间" cssClass="form-txtinput" id="hyrqBegin" size="10" maxlength="10" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="%{model.uptimeBegin}"/>
    					<input type="submit" value="查询"/>
    				</div>
    				<table width="100%" align="center" class="list-table" borderColor="#e3ecf6" bgColor="#e3ecf6" border="0" cellSpacing="1" cellPadding="0">
	    				<tr style="background: #f6fbff;height: 30px;">
	    					<td width="5%" align="center">序号</td>
	    					<td width="20%" align="center">会议主题</td>
	    					<td width="10%" align="center">会议日期</td>
	    					<td width="10%" align="center">时间段</td>
	    					<td width="10%" align="center">会议室</td>
	    					<td width="10%" align="center">预定人</td>
	    					<td width="20%" align="center">参与人员</td>
	    					<td width="14%" align="center">查看</td>
	    				</tr>
	    				<c:forEach items="${page.result}" var="item" varStatus="status">
						<tr height="30"${status.index%2 == 0?'class="gray"':''}>
							<td align="center">${page.thisPageFirstElementNumber + status.index}</td>
							<td align="left">${item.zt}</td>
							<td align="left">${item.hyrqString}</td>
							<td align="left">${item.strtime}</td>
							<td align="left">${item.dataname}</td>
							<td align="left">${item.username }</td>
							<td align="left" class="sl">
								<c:forEach items="${item.meetingUsers}" var="item2" varStatus="status2">
								${item2.username},
								</c:forEach>
							</td>
							<td align="center">
								<c:if test="${sessionScope.loginInfo.userid == item.ydr}">
								<a href="javascript:;" onclick="meetingEdit('${item.id}')">编辑</a> | 
								<a href="javascript:;" onclick="delMeeting('${item.id}')">删除</a> | 
								</c:if>
								<a href="javascript:;" onclick="meetingDetail('${item.id}')">查看</a> | 
								<a href="${ctx}/meeting_print.do?id=${item.id}" target="_blank">打印</a>
							</td>
						</tr>
						</c:forEach>
						
						<c:if test="${fn:length(page.result)==0}">
						<tr>
					    	<td colspan="7"><div class="note_red_in_div">系统没有查找到符合条件的数据！</div></td>
					    </tr>
					    </c:if>
    				</table>
    				<input type="hidden" name="pageNumber" value="${page.thisPageNumber}"/>
					<input type="hidden" name="pageSize" value="${page.pageSize}"/>
					<simpletable:homePageToolbar page="${page}"/>
    				</s:form>
    			</div>
    		</div>
    		<div class="clear"></div>
    	</div>
    	<%@include file="../bottom.jsp"%>
    </div>
  </body>
</html>
<script type="text/javascript">
function meetingDetail(id){
  $.dialog({id:'abc', title:'会议详情', content: 'url:${ctx}/meeting_show.do?id='+id+'&timestamp='+new Date().getTime(), max:true,min:false,width:600, height:400});
}

function meetingEdit(id){
  $.dialog({id:'abc', title:'会议详情', content: 'url:${ctx}/meeting_edit.do?id='+id+'&timestamp='+new Date().getTime(), max:true,min:false,width:600, height:500});
}

function delMeeting(id){
	jQuery.ajax({
	   	type:'post',	
	   	url:'${ctx}/meeting_delByMy.do?id='+id+'&timestamp='+new Date().getTime(),
	   	dataType:'xml',
	   	success:resultHandler,
	    error:resultHandler,
	    processData:false
	});
}

function resultHandler(responseXML){
	var result = responseXML.getElementsByTagName("result")[0].firstChild.nodeValue;
	var message = responseXML.getElementsByTagName("error-message")[0].firstChild.nodeValue;
	var errorType = responseXML.getElementsByTagName("error-type")[0].firstChild.nodeValue;
	if(!eval(result)&&(errorType!=2)){
		alert(message);
	}else{
		var curDate = new Date(); 
		alert(message);
		location.replace("${ctx}/meeting_search.do?timsStamp=" + curDate.getTime());
	}
}

var limitLength = 13;//限制多少个字数
limitLen();
function limitLen(){
	$(".sl").each(function(i, n) {
		var s = n.innerHTML;
		n.title = s;
		if(s.length>limitLength){
			n.innerHTML = s.substring(0,limitLength)+"...";
		}
		else if(s.length < limitLength){
			for(var c = s.length;c<limitLength+3;c++){//+3是因为后面三个...
				s += " ";	
			}
			$(this).innerHTML = s;
		}
	});
}
</script>